<!DOCTYPE html>
<?
session_start();
require_once('config.php');
require_once('classes/class.jira.php');
include("classes/connect.php");
//ini_set('display_errors', 'Off');



$DBID=$_GET['id'];
$current=$_GET['currentstatus'];
$assignee=$_GET['currentassignee'];
$vcode=$_GET['vcode'];
$username = $_SESSION["Juname"];
$pass = $_SESSION["Jpass"];
	
function getstatus($username,$pass,$host,$issu){
		$config->username= $username;
		$config->password= $pass;
		$config->port= "";
		$config->host= $host;
			$queryIssue = new Jira($config);
			$array=$queryIssue->queryStatus($issu);
			$response = json_decode($array->responseBody);
			return $response;
		}
function getquery($username,$pass,$host,$projectid){
		$config->username= $username;
		$config->password= $pass;
		$config->port= "";
		$config->host= $host;
		$query->id = $projectid;
			$queryIssue = new Jira($config);
			$array=$queryIssue->queryIssue($query);
			$response = json_decode($array->responseBody);
			return $response;
		}
function getuser($username,$pass,$project,$host){
		$config->username= $username;
		$config->password= $pass;
		$config->port= "";
		$config->host= $host;
		$query->project = $project;

		$queryIssue = new Jira($config);
		$array=$queryIssue->queryUser($query);
		$response = json_decode($array->responseBody);
		return $response;
		}
function getpriority($username,$pass,$host){
		$config->username= $username;
		$config->password= $pass;
		$config->port= "";
		$config->host= $host;

		$queryIssue = new Jira($config);
		$array=$queryIssue->queryAllPriority();
		$response = json_decode($array->responseBody);
		return $response;
		}
function getDisplay($username,$pass,$host){
        $config->username= $username;
        $config->password= $pass;
        $config->port= "";
        $config->host= $host;

        $queryIssue = new Jira($config);
        $array=$queryIssue->getUser($username);
        $response = json_decode($array->responseBody);
        return $response;
        }
function getName($username,$pass,$host,$name){
        $config->username= $username;
        $config->password= $pass;
        $config->port= "";
        $config->host= $host;

        $queryIssue = new Jira($config);
        $array=$queryIssue->getUser($name);
        $response = json_decode($array->responseBody);
        return $response;
        }

?>

<html>
<head>
    <title>Basic usage</title>

   
    <link rel="stylesheet" href="css/header.css" type="text/css" media="all">           
            <!--<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">-->
            
        <link href="reports/examples/content/shared/styles/examples-offline.css" rel="stylesheet">
        <link href="reports/examples/content/shared/styles/kendo.common.min.css" rel="stylesheet">
        <link href="reports/examples/content/shared/styles/kendo.rtl.min.css" rel="stylesheet">
        <link href="reports/examples/content/shared/styles/kendo.default.min.css" rel="stylesheet">

        <script src="reports/js/jquery.min.js"></script>
        <script src="reports/js/kendo.web.min.js"></script>
        <script src="reports/js/console.js"></script>
            
        <link href="reports/js/kendo.dataviz.min.js" rel="stylesheet">        
        <link href="css/demo.css" rel="stylesheet" type="text/css" />
         
    <!--<script type="text/javascript" src="js/calendarDateInput.js"></script>-->
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>-->
<!--<script type="text/javascript" src="js/jquery.timePicker.js"></script>-->
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
    
    <script>
        
    </script>
  
    
</head>

<script type="text/javascript">
//===================ajax commands for attachments================================
function getattach(filename,dbid,jiraid){
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	document.getElementById("ajaxattach").innerHTML='';
    document.getElementById("ajaxattach").innerHTML=xmlhttp.responseText;
    }
  }	
xmlhttp.open("GET","ajaxdeleteattach.php?filename="+escape(filename)+"&dbid="+dbid+"&jiraid="+jiraid,true);
xmlhttp.send();
}
window.onunload = function (e) {
	var a = window.opener.document.getElementById("selectpage").innerHTML
	var n=a.replace(" ",""); 
	var b=n.replace(" ",""); 
    opener.getdata(b); //or
};
</script>
<script type="text/javascript">
//=============displaying time in 24hr Format=============================
//  jQuery(function() {
//    // 02.00 AM - 03.30 PM, 15 minutes steps.
//    $("#timefrom").timePicker({
//  startTime: "07:00",  // Using string. Can take string or Date object.
//  endTime: new Date(0, 0, 0, 19, 30, 0),  // Using Date object.
//  show24Hours: false,
//  separator:'.',
//  step: 15});
//  
//   $("#timeto").timePicker({
//  startTime: "08:00",  // Using string. Can take string or Date object.
//  endTime: new Date(0, 0, 0, 19, 30, 0),  // Using Date object.
//  show24Hours: false,
//  separator:'.',
//  step: 15});
//
//    $("#testtimefrom").timePicker({
//  startTime: "07:00",  // Using string. Can take string or Date object.
//  endTime: new Date(0, 0, 0, 19, 30, 0),  // Using Date object.
//  show24Hours: false,
//  separator:'.',
//  step: 15});
//  
//   $("#testtimeto").timePicker({
//  startTime: "07:00",  // Using string. Can take string or Date object.
//  endTime: new Date(0, 0, 0, 19, 30, 0),  // Using Date object.
//  show24Hours: false,
//  separator:'.',
//  step: 15}); 
// 
//    var oldTime = $.timePicker("#timefrom").getTime();
//    $("#timefrom").change(function() {
//      if ($("#timeto").val()) { // Only update when second input has a value.
//        // Calculate duration.
//        var duration = ($.timePicker("#timeto").getTime() - oldTime);
//        var time = $.timePicker("#timefrom").getTime();
//        $.timePicker("#timeto").setTime(new Date(new Date(time.getTime() + duration)));
//        oldTime = time;
//      }
//    });
//    $("#timeto").change(function() {
//      if($.timePicker("#timefrom").getTime() >= $.timePicker(this).getTime()) {
//        $(this).addClass("errortime");
//		alert("Invalid End Time. Please Check..!");
//      }
//      else {
//        $(this).removeClass("errortime");
//      }
//    });
//  
//  var oldTime1 = $.timePicker("#testtimefrom").getTime();
//    $("#testtimefrom").change(function() {
//      if ($("#testtimeto").val()) { // Only update when second input has a value.
//        // Calculate duration.
//        var duration1 = ($.timePicker("#testtimeto").getTime() - oldTime1);
//        var time1 = $.timePicker("#testtimefrom").getTime();
//        $.timePicker("#testtimeto").setTime(new Date(new Date(time1.getTime() + duration1)));
//        oldTime1 = time1;
//      }
//    });
//    $("#testtimeto").change(function() {
//      if($.timePicker("#testtimefrom").getTime() >= $.timePicker(this).getTime()) {
//        $(this).addClass("errortime");
//		alert("Invalid End Time. Please Check..!");
//      }
//      else {
//        $(this).removeClass("errortime");
//      }
//    });
//  });
//  
  //===================summary change=====================================
function summaryreplace(){
    
		// var str=document.getElementById("summary").value;
		 var e = document.getElementById("post").value;
                 document.getElementById("summary").value = e+"-<?php echo $_GET['name'];?>";
               //  alert(e);
		/* var n = ""
		 var selval = e.options[e.selectedIndex].value;
		 var cc = e.options.length;
		 var found = "FALSE";
		 var f = "";
		 for(i=1;i<cc;i++)
		 {
		  if(str.indexOf(e.options[i].value) != -1)
		  {
		   found= "true";
		   f = e.options[i].value;
		   break;
		  }
		 }
		 
		 if(found == "true"){
		   n=str.replace(f,selval);
		 }else{ 
		  n = selval + " - " + str; 
		 }
		 if(e.options[e.selectedIndex].value == "")
		 {
		  n=n.replace(" - ","");
		 }
		 document.getElementById("summary").value = n;*/
}
//===================summary change with NIC==================================

function nictosummary(){
	if(document.getElementById("post").value!=""){ //post is selected
		var summary=document.getElementById("summary").value;
		var array=summary.split("-");
		if(document.getElementById("nic").value==""){	//nic field is empty
			if(array.length>2){ //summary is already updated
				document.getElementById("summary").value=array[0] + "-" + array[2];
			}
			else{ //summary is not updated yet(initial change)
				
			}
			
		}
		else{ //nic field has a value
			if(array.length>2){ //summary is already updated
				var nic=document.getElementById("nic").value;
				document.getElementById("summary").value=array[0] + "- " + nic +" -" + array[2];
			}
			else{ //summary is not updated yet(initial change)
				var nic=document.getElementById("nic").value;
				document.getElementById("summary").value=array[0] + "- " + nic +" -" + array[1];
			}
		}
	}
	else{	
		alert("please select a post for the applicant");
		document.getElementById("nic").value="";
	}
	
}
//==========================input changed email content==========================================
function emailchange(){
	var e=document.getElementById("emailchange").innerHTML;
	document.getElementById("emailcontent").value = e;
	
	var h=document.getElementById("emailchangesubject").innerHTML;
	document.getElementById("emailcontentsubject").value = h;
	
	var f=document.getElementById("emailchangeoffer").innerHTML;
	document.getElementById("emailcontentoffer").value = f;
	
	var i=document.getElementById("emailchangeoffersubject").innerHTML;
	document.getElementById("emailcontentoffersubject").value = i;
	
	var g=document.getElementById("emailchangeselected").innerHTML;
	document.getElementById("emailcontentselected").value = g;
	
	var j=document.getElementById("emailchangeselectedsubject").innerHTML;
	document.getElementById("emailcontentselectedsubject").value = j;

	return true;
}

//======================slide divs===========================================================

 $(".poptitleslide").live('click',function () {
 if($(".popcategorycontainerslide").is(":hidden")){
	$(".popcategorycontainerslide").slideDown("slow");
	}
 else{
	$(".popcategorycontainerslide").slideUp("slow");
 }
});


//==========================multiple checkbox,prompt status change on assignee change and status change=================================
$(document).ready( function() {
	$(".chosen").chosen();

   $('#popassigneedrop').bind('change', function (e) {  
	if($('#post').val()==""){
		alert('please select a JOB POST for the applicant');
	}
  });
  
  $('#popstatusdrop').bind('change', function (e) { 
	if($('#post').val()!=""){
		if( $('#popstatusdrop').val() == 31 || $('#popstatusdrop').val() == 211 || $('#popstatusdrop').val() == 261 || $('#popstatusdrop').val()==481) {

			
		  	$('#popinterview').show();
		  //alert($('#popstatusdrop').val());
		}
		else{
		  $('#popinterview').hide();
		} 
		
		   
		if($('#popstatusdrop').val() == 41 || $('#popstatusdrop').val() == 61){
		  $('#poptest').show();
		}
		else{
			$('#poptest').hide();
		}

		
		if($('#popstatusdrop').val() == 261 || $('#popstatusdrop').val() == 131 || $('#popstatusdrop').val() == 111 || $('#popstatusdrop').val() == 71 || $('#popstatusdrop').val() == 231 || $('#popstatusdrop').val() == 131){
			 $('.popemailcontentholder').show();
		}
		else{
			$('.popemailcontentholder').hide();
		}

		
		if($('#popstatusdrop').val() == 261){
		  $('#showemailchange').show();
		  if($(".popcategorycontainerslide").is(":visible")){
			$(".popcategorycontainerslide").slideUp("slow");
			}		  
		}
		else{
			$('#showemailchange').hide();
			if($(".popcategorycontainerslide").is(":hidden")){
			$(".popcategorycontainerslide").slideDown("slow");
			}
		}

		
		if($('#popstatusdrop').val() == 131){
		  $('#showemailchangeoffer').show();
		  if($(".popcategorycontainerslide").is(":visible")){
			$(".popcategorycontainerslide").slideUp("slow");
			}
		}
		else{
			$('#showemailchangeoffer').hide();
			if($(".popcategorycontainerslide").is(":hidden")){
			$(".popcategorycontainerslide").slideDown("slow");
			}
		}

		
		if($('#popstatusdrop').val() == 111 || $('#popstatusdrop').val() == 71 || $('#popstatusdrop').val() == 231){
		  $('#showemailchangeselected').show();
		  if($(".popcategorycontainerslide").is(":visible")){
			$(".popcategorycontainerslide").slideUp("slow");
			}
		}
		else{
			$('#showemailchangeselected').hide();
			if($(".popcategorycontainerslide").is(":hidden")){
			$(".popcategorycontainerslide").slideDown("slow");
			}
		}

		
		if($('#popstatusdrop').val() == 131){
		  $('#joindate').show();
		  if($(".popcategorycontainerslide").is(":visible")){
			$(".popcategorycontainerslide").slideUp("slow");
			}
		}
		else{
			$('#joindate').hide();
			if($(".popcategorycontainerslide").is(":hidden")){
			$(".popcategorycontainerslide").slideDown("slow");
			}
		}

		
		if($('#popstatusdrop').val() == 131 || $('#popstatusdrop').val() == 41 || $('#popstatusdrop').val() == 61 ||  $('#popstatusdrop').val() == 31 || $('#popstatusdrop').val() == 211 || $('#popstatusdrop').val() == 261 || $('#popstatusdrop').val() == 481){
			$('#popcategorycontainer').show();
		}
		else{
			$('#popcategorycontainer').hide();
		}
		
	}
	else{
		alert('please select a JOB POST for the applicant');
	}
	});
});
$('#post').change(function(){
       $('#summary').html($(this).val());
});
//=====================Tab switch=====================================
function tab(tab) {
document.getElementById('tab1').style.display = 'none';
document.getElementById('tab2').style.display = 'none';
document.getElementById('tab3').style.display = 'none';
document.getElementById('tab4').style.display = 'none';
document.getElementById('li_tab1').setAttribute("class", "");
document.getElementById('li_tab2').setAttribute("class", "");
document.getElementById('li_tab3').setAttribute("class", "");
document.getElementById('li_tab4').setAttribute("class", "");
document.getElementById(tab).style.display = 'block';
document.getElementById('li_'+tab).setAttribute("class", "active");
}

$(document).ready(function() {
	var kWindowAlert = $('#windowWrong').kendoWindow({
        width: "435px",
        title: "Wrong Time Selection",
        visible: false,
        modal:true,
        left:"18%",

        }).data('kendoWindow').center();
          $('.okbtn').click(function () {  
       	   kWindowAlert.close();
        });
});



function notifyemail(){

	//alert('<?php //echo $action_InterviewCalled;?>');
	//alert($('#popstatusdrop').val());
	if($('#chosen').val()=='' || $('#chosen').val()==null && $('#popstatusdrop').val()==31)
	{
		alert('Notify is required');
		//document.getElementById("error").innerHTML ="Notify is required";
		//$("#chosen").wrapper.find(".k-input").css("background", "#BDD1FF"); 
		return false;
	}


	// Test scheduling
	if($('#chosenTest').val()=='' || $('#chosenTest').val()==null && $('#popstatusdrop').val()==41)
	{
		alert('Notify is required');
		return false;
	}
	if($('#chosenTest').val()=='' || $('#chosenTest').val()==null && $('#popstatusdrop').val()==61)
	{
		alert('Notify is required');
		return false;
	}

// schedule final interview
	if($('#chosen').val()=='' || $('#chosen').val()==null && $('#popstatusdrop').val()==481)
	{
		alert('Notify is required');
		//document.getElementById("error").innerHTML ="Notify is required";
		//$("#chosen").wrapper.find(".k-input").css("background", "#BDD1FF"); 
		return false;
	}
	if($('#chosen').val()=='' || $('#chosen').val()==null && $('#popstatusdrop').val()==261)
	{
		alert('Notify is required');
		//document.getElementById("error").innerHTML ="Notify is required";
		//$("#chosen").wrapper.find(".k-input").css("background", "#BDD1FF"); 
		return false;
	}
	if($('#chosen').val()=='' || $('#chosen').val()==null && $('#popstatusdrop').val()==211)
	{
		alert('Notify is required');
		//document.getElementById("error").innerHTML ="Notify is required";
		//$("#chosen").wrapper.find(".k-input").css("background", "#BDD1FF"); 
		return false;
	}
	
}

  </script>

<body class="sonata-bc" >

              
   <div class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container-fluid header-bar-container">
                <div class="header-bar-top">
                    <a class="brand">
                        <img src="images/logo_white.png" alt="JiraPortal">Recruitment Application      
                    </a>
                </div>
            </div>

            <div class="container-fluid">
                <a class="btn btn-navbar" data-target=".nav-collapse" data-toggle="collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="nav-collapse">
                    <ul class="nav" id="menu" style="background-color: #1C2326">
                        <li >
                            <a><?php if(isset($_GET['name'])){echo $_GET['name'];}?></a>
                        </li>
                      

                        <div class="navbar-text" style="top: 18px;">
                          
                    <p style="color: #FFFFFF;font-size: 15px;font-weight: 100;"> Welcome <?php

                            $display=  getDisplay($username, $pass, $host);
                           echo $display->displayName;
                        
                        ?> [ <a href="logout.php">Logout</a> ]<p>
                </div>
            </div>
        </div>

        </div>
    </div>   
    
        <div id="example" class="k-content">
            <div id="forecast" >
                <div id="tabstrip">
                    <ul style="position: relative;left: 3px;top: 0;">
                        <li class="k-state-active">
                             Recruit Process
                           
                        </li>
                        <li>
                             Personal Details
                        </li>
                        <li>
                            Activity Log
                        </li>
                        <li>
                            Comments 
                        </li>
                        <li>
                            Previous Records 
                        </li>
                    </ul>
                   
                    <div style="height: 710px;">
                        <div>
                            <script>
                                  $(document).ready(function() {                   
                                    $("#priority").kendoDropDownList();     
                                    $("#popstatusdrop").kendoDropDownList();  
                                    $("#post").kendoDropDownList();     
                                    $("#popassigneedrop").kendoDropDownList(); 
                                    $("#locinterview").kendoDropDownList();
                                    $("#chosen").kendoMultiSelect().data("kendoMultiSelect");
                                    $("#locTest").kendoDropDownList();
                                    $("#testtype").kendoDropDownList();
                                    $("#chosenTest").kendoMultiSelect().data("kendoMultiSelect");
                                  });
                              </script>
                              
                              <form action='update.php?id=<?=$_GET['id']?>&jiraid=<?=$_GET['jiraid']?>&currentstatus=<?=$current?>&currentassignee=<?=$assignee?>&vcode=<?=$vcode?>&parent=<?=$_GET['parent']?>&curstatus=<?=$_GET['curstatus']?>&pageno=<?=$_GET['pageno']?>&assignee=<?=$_GET['assignee']?>&post=<?=$_GET['post']?>&priority=<?=$_GET['priority']?>&fromDate=<?=$_GET['fromDate']?>&toDate=<?=$_GET['toDate']?>' method='post' onsubmit="return notifyemail(); ">
                              
                              <div style="float:left; float: left; padding-right: 17px;">
                                <?
                                $sqlq="SELECT * from trn_emaildetails where id='".$DBID."'";
                                $rs =mysql_query($sqlq);
                                $row = mysql_fetch_array($rs);
                                $projectname=getquery($username,$pass,$host,$_GET['jiraid'])->issues[0]->key;
                                
                                //var_dump($projectname);
                                ?>
                                
                                        <fieldset>
                                            <legend>JIRA Information</legend>

                                                 <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail" style=" font-size: 18px;top: 5px;"><a href="https://eyepax.atlassian.net/browse/<?=$projectname?>" target="_blank">JIRA ID : <?=$projectname?> </a></label>
                                                                <div class="controls">
                                                                    <!--<input type="text" value="<?=$projectname?>" class="k-textbox k-invalid" readonly  placeholder="Jira ID">-->
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Post</label>
                                                                <div class="controls">
                                                                    <?php
                                                                        $postsql="select * from sys_jobposts where active='1'";
                                                                        $execpostquery =mysql_query($postsql);						
                                                                    ?>
                                                                    <select id="post" name="post" onchange="summaryreplace()" >
                                                                        <option value="">-- Select the Post--</option>
                                                                        <?php
                                                                        while($posts = mysql_fetch_array($execpostquery)){
                                                                        if($posts['code']==$row['post']){
                                                                        echo "<option selected='selected' value='".$posts['code']."'>".$posts['postname']."</option>";
                                                                        }
                                                                        else{
                                                                        echo "<option value='".$posts['code']."'>".$posts['postname']."</option>";							
                                                                        }
                                                                        }
                                                                        ?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>


                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Priority</label>
                                                                <div class="controls">
                                                                    <?php $priority=getpriority($username,$pass,$host);?>
                                                                    <select name="priority" id="priority">
                                                                        <?php foreach($priority as $key){
                                                                            if($key->name==$row['priority']){
                                                                                    echo "<option selected='selected' value='".$key->name."'>".$key->name."</option>";
                                                                            }
                                                                            else{		
                                                                            ?>		
                                                                                    <option name="priority" value="<?php echo $key->name ?>"><?php echo $key->name ?></option>
                                                                            <?}}?>
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Status</label>
                                                                <div class="controls">
                                                                    <?php $status=getstatus($username,$pass,$host,$_GET['jiraid']);
                                                                          //var_dump($status);                                                                       
                                                                    ?>
                                                                     <select id="popstatusdrop"   name="status">
                                                                       <?php echo "<option selected='selected' value='".$row['currentStatus']."'>".$row['currentStatus']."</option>";?>
                                                                    <?php foreach($status->transitions as $key){                                                                               
                                                                        ?>		
                                                                            <option name="status" value="<?php echo $key->id ?>"><?php echo $key->name ?></option>
                                                                    <?php }?>	
                                                                    </select>
                                                                </div>
                                                            </div>
                                                        </div>

                                                       <div class="span3"> 
                                                <div class="control-group">
                                                    <label class="control-label" for="inputEmail">Assignee</label>
                                                    <div class="controls">
                                                        <?$user=getuser($username,$pass,$project,$host);?>
                                                         <select id="popassigneedrop" name="assignee">
                                                            <?foreach($user as $key){
                                                                if($key->name==$row['currentAssignee']){
                                                                        echo "<option selected='selected' value='".$key->name."'>".$key->displayName."</option>";
                                                                }
                                                                else{		
                                                                ?>		
                                                                        <option name="assignee" value="<?php echo $key->name ?>"><?php echo $key->displayName ?></option>
                                                                <?}}?>
                                                        </select>
                                                    </div>
                                                </div>
                                        </div>
                                            
                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">JIRA Summary : </label>
                                                                <div class="controls">
                                                                    <input style="min-width: 300px;" id="summary" name="summary" type="text" value="<?php echo $row['currentSummary']; ?>" class="k-textbox k-invalid"  placeholder="Jira ID">
                                                                </div>
                                                            </div>
                                                        </div>
                                              <div class="popemailcontentholder">
				<a href="#"><div class="poptitleslideemail">Email Information</div></a>
				<div class="popcategorycontainerslideemail">				
				<div class="popdyanmiccontentalign">
					<div class="popemailcontainer" id="showemailchange">
						<p>Please change the applicant email as he has rescheduled his final interview</p>
						<div class="editablesub" contenteditable="true" id="emailchangesubject">
							<?=$finalinterviewsubject?>
						</div>
						<div class="editable" contenteditable="true" id="emailchange">
							<?=$finalinterviewdateinform?>
						</div>
						<input type="checkbox" class="popsendmail" name="emailsend">
						<p class="popsendmailpara">Send Mail</p>
					</div>
					<input type="hidden" id="emailcontent" name="emailcontent">
					<input type="hidden" id="emailcontentsubject" name="emailcontentsubject">
					
					<div class="popemailcontainer" id="showemailchangeoffer">
						<p>Please change the applicant email as per your prerequisites</p>
						<div class="editablesub" contenteditable="true" id="emailchangeoffersubject">
							<?=$offersubject?>
						</div>
						<div class="editable" contenteditable="true" id="emailchangeoffer">
							<?=$offerinform?>
						</div>
						<input type="checkbox" class="popsendmail" name="emailsendoffer">
						<p class="popsendmailpara">Send Mail</p>
					</div>
					<input type="hidden" id="emailcontentoffer" name="emailcontentoffer">
					<input type="hidden" id="emailcontentoffersubject" name="emailcontentoffersubject">
					
					<div class="popemailcontainer" id="showemailchangeselected">
						<p>Please change the applicant email as per your prerequisites</p>
						<div class="editablesub" contenteditable="true" id="emailchangeselectedsubject">
							<?=$selectedsubject?>
						</div>
						<div class="editable" contenteditable="true" id="emailchangeselected">
							<?=$selectedinform?>
						</div>
						<input type="checkbox" class="popsendmail" name="emailsendselected">
						<p class="popsendmailpara">Send Mail</p>
					</div>
					<input type="hidden" id="emailcontentselected" name="emailcontentselected">
					<input type="hidden" id="emailcontentselectedsubject" name="emailcontentselectedsubject">
				</div>
				</div>
				</div>

                                        </fieldset>
                                  
                                  <fieldset id="popcategorycontainer" style="display: none;">
                                            <legend> Scheduling Information </legend>
                                            <div id="popinterview">
                                            
                                                    <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Location</label>
                                                                <div class="controls">
                                                                   
                                                                    <select name="locinterview" id="locinterview">
                                                                        <?
                                                                        foreach($location as $value){
                                                                                echo "<option value='".$value."'>".$value."</option>";
                                                                        }
                                                                        ?>
                                                                        </select>
                                                                </div>
                                                            </div>
                                                    </div>
                                                    <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Date/Time</label>
                                                                <div class="controls">
                                                                    <input id="interviewdate" name="interviewdate"  value="<?php echo date('Y/m/d');?>" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">From</label>
                                                                <div class="controls">
                                                                    <input id="timepickerFrom" name="timepickerFrom" value="10:00 AM" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                 <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">To</label>
                                                                <div class="controls">
                                                                    <input id="timepickerTo" name="timepickerTo" value="10:30 AM" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                     
                                                 <div id="windowWrong">
                                                    <p class="delete-message"></br> End time should be greater than the Starting time</p>
                                                    <input type="button" class="okbtn k-button" value="Yes" style="font-size: 16px;padding: 4px 20px;position: relative; left: 150px" />
                                                      
                                                  </div>
                                                <script>
                                                    $(document).ready(function() {
                                                      
                                                        $("#interviewdate").kendoDatePicker({
                                                      format: "yyyy-MM-dd"
                                                      });
                                                      $("#timepickerFrom").kendoTimePicker({interval: 15,format: "hh:mm tt",parseFormats: ["HH:mm:ss"],change: startChange});
                                                      $("#timepickerTo").kendoTimePicker({interval: 15,format: "hh:mm tt",parseFormats: ["HH:mm:ss"],change: startChange});
                                                       
                                                        function startChange() {
                                                            var from=new Date("1/1/2007 " +  $("#timepickerFrom").val());
                                                            var to=new Date("1/1/2007 " + $("#timepickerTo").val());
                                                            
                                                            if(to<=from)
                                                                {
                                                                    //alert('Wrong');
                                                                    kWindow.open();
                                                                }
                                                            
                                                        }
                                                        
                                                        var kWindow = $('#windowWrong').kendoWindow({
                                                        width: "435px",
                                                        title: "Wrong Time Selection",
                                                        visible: false,
                                                        modal:true,
                                                        left:"18%",

                                                        }).data('kendoWindow').center();
                                                          $('.okbtn').click(function () {  
                                                                kWindow.close();
                                                        });


                                                          
                                                    });
                                        </script>

                                               
                                                 <div  class="span3"> 
                                                            <div class="control-group" >
                                                                <label class="control-label" for="inputEmail">Notify</label>
                                                                <div class="controls"style="width: 350px;">
                                                                   
                                                                    <select name="notify[]" id="chosen"  multiple="multiple" data-placeholder="Select..." >
                                                                       <?$i=0;
                                                                       foreach($user as $key){
                                                                        ?>	
                                                                        		
                                                                                <option  name="notify[]" value="src=<?php echo $key->name ?>%40eyepax.com&amp;color=%23<?php echo $calendarColor[$i];?>&amp"><?php echo $key->displayName ?></option>
                                                                        <?
																			$i=$i+1;
																			}?>
                                                                        </select>
                                                                       
                                                                </div>
                                                            </div>
                                                             <button type="button" class="k-button" id="subCalendar" name='subCalendar' style="float: right; margin-top: -19px; background-image: url('images/calen.png'); background-repeat: no-repeat;background-size: 38px;padding: 17px 20px;"></button> 
                                                             <div id="empty"><p id="error" style="color: #FF0000; font-size: 13px;margin: 0 35px; line-height: 10px;"></p></div> 
                                                    </div>
                                                    
       
                                                     <div id="windowWeek" >
                                 						<p style="font-size: 11px; color: green;">Note: If you are login first time or calendar is not properly displayed, please subscribe again and refresh your page</p>
                                                        
                                                         <div id="heading" style="position: absolute;top: 8px"><label>Carrers</label></div>    
                            
                              							<!--  <iframe src="https://www.google.com/calendar/embed?mode=WEEK&amp;height=700&amp;wkst=2&amp;bgcolor=%23FFFFFF&amp;src=careers%40eyepax.com&amp;color=%232952A3&amp;src=achira.p%40eyepax.com&amp;color=%23125A12&amp;src=chamila.m%40eyepax.com&amp;color=%236B3304&amp;src=charith.r%40eyepax.com&amp;color=%23182C57&amp;src=%23contacts%40group.v.calendar.google.com&amp;color=%232F6309&amp;src=derick.k%40eyepax.com&amp;color=%23711616&amp;src=gawesha.b%40eyepax.com&amp;color=%23B1440E&amp;src=gayan.m%40eyepax.com&amp;color=%23875509&amp;src=lakshitha.w%40eyepax.com&amp;color=%235F6B02&amp;src=madushan.n%40eyepax.com&amp;color=%231B887A&amp;src=mahesha.h%40eyepax.com&amp;color=%23B1365F&amp;src=sanjaya.k%40eyepax.com&amp;color=%23853104&amp;src=tamara.s%40eyepax.com&amp;color=%2342104A&amp;src=tharaka.r%40eyepax.com&amp;color=%238D6F47&amp;src=tishan.m%40eyepax.com&amp;color=%23333333&amp;src=udeepa.j%40eyepax.com&amp;color=%23865A5A&amp;ctz=Asia%2FColombo" style=" border-width:0 " width="1000" height="700" frameborder="0" scrolling="no"></iframe> -->
                             							<div id="iframeCalendar" style="position: relative; top: 23px;"><iframe  src="http://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;mode=WEEK&amp;src=careers%40eyepax.com&color=%232952A3&amp;ctz=Asia/Colombo" style="border: 0" width="1000" height="600" frameborder="0" scrolling="no"></iframe></div>
 
                             						</div> 
                             						<script>
                                    $(document).ready(function() {
                                      //  $("#chosen").kendoMultiSelect().data("kendoMultiSelect");  

                                        var windowWeek = $("#windowWeek"),
                                        undoWeek = $("#subCalendar").bind("click", function() {
                                                    windowWeek.data("kendoWindow").open();
                                                    var str=$('#chosen').val();
                                                	var rest =str.join("amp;");

                                                	 
                                                	var val = decodeURIComponent($('#chosen').val());                                                	
                                                	var myArray = val.split('src=');
                                                	var res=[];
                                                	for (var i = 1; i < myArray.length; i++) {
													   
													   var emai=myArray[i].split('&color=');
													   //alert(emai[0]);
													   res[i-1]=emai[0];
													}
                                                	//alert(res);
                                                	//var res =str.join("amp;");
                                                	var mail=$('#chosen').find('option:selected').text();
                                                	var user=mail.split('@eyepax.com');
                                               	var resUser =res.join(", ");
                                                	$("#heading").html('<div id="heading"><label>Calendar for '+resUser+'</label></div>');
                                                    $("#iframeCalendar").html('<div id="iframeCalendar"style="position: relative; top: 14px;"><iframe src="http://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;mode=WEEK&amp;'+rest+'amp;ctz=Asia/Colombo" style="border: 0" width="1000" height="600" frameborder="0" scrolling="no"</div>></iframe>');
                                                	                                                                
                                                });
                                    var onClose = function() {
                                        undoWeek.show();
                                    }

                                    if (!windowWeek.data("kendoWindow")) {
                                        windowWeek.kendoWindow({
                                            width: "1020px",
                                             visible  : false,
                                            title: "Google Calendar",
                                            actions: [                                

                                                "Close"
                                            ],
                                            close: onClose
                                        });
                                        undoWeek.show();
                                    }
                
                                $("#windowWeek").closest(".k-window").css({
                                top: "10%",
                                left:"10%"
                                });                                 
                                    	
                                });

                                    
                            </script>
								
					</div>
					<div id="poptest" class="pop2div">
                                            
                                             <div  class="span3"> 
                                                <div class="control-group">
                                                    <label class="control-label" for="inputEmail">Location</label>
                                                    <div class="controls">

                                                        <select name="loctest" id="locTest">
                                                            <?
                                                            foreach($location as $value){
                                                                    echo "<option value='".$value."'>".$value."</option>";
                                                            }
                                                            ?>
                                                            </select>
                                                    </div>
                                                </div>
                                        </div>
					<div  class="span3"> 
                                                <div class="control-group">
                                                    <label class="control-label" for="inputEmail">Test Type</label>
                                                    <div class="controls">

                                                        <select name="type" id="testtype">
                                                            <?
							foreach($testtype as $value){
								echo "<option value='".$value."'>".$value."</option>";
							}
							?>
                                                            </select>
                                                    </div>
                                                </div>
                                        </div>	
                                           <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Test Date/Time</label>
                                                                <div class="controls">
                                                                    <input id="testdate" name="testdate" value="<?php echo date('Y/m/d');?>" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">From</label>
                                                                <div class="controls">
                                                                    <input id="timepickertestFrom" name="timepickertestFrom" value="10:00 AM" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                 <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">To</label>
                                                                <div class="controls">
                                                                    <input id="timepickertestTo" name="timepickertestTo" value="10:15 AM" />
                                                                </div>
                                                            </div>
                                                    </div>
                                                <script>
                                                    $(document).ready(function() {
                                                      
                                                        $("#testdate").kendoDatePicker({
                                                      format: "yyyy-MM-dd"
                                                      });
                                                      $("#timepickertestFrom").kendoTimePicker({interval: 15,format: "hh:mm tt",parseFormats: ["HH:mm:ss"],change: startChange});
                                                      $("#timepickertestTo").kendoTimePicker({interval: 15,format: "hh:mm tt",parseFormats: ["HH:mm:ss"],change: startChange});
                                                       
                                                        function startChange() {
                                                            var from=new Date("1/1/2007 " +  $("#timepickertestFrom").val());
                                                            var to=new Date("1/1/2007 " + $("#timepickertestTo").val());
                                                            
                                                            if(to<=from)
                                                                {
                                                                    //alert('Wrong');
                                                                    kWindow.open();
                                                                }
                                                            
                                                        }
                                                        
                                                        var kWindow = $('#windowWrong').kendoWindow({
                                                        width: "435px",
                                                        title: "Wrong Time Selection",
                                                        visible: false,
                                                        modal:true,
                                                        left:"18%",

                                                        }).data('kendoWindow').center();
                                                          $('.okbtn').click(function () {  
                                                                kWindow.close();
                                                        });
                                                        
                                            
                                                    $("#join").kendoDatePicker({
                                                      format: "yyyy-MM-dd"
                                                      });
                                                      
                                                        
                                                    });
                                        </script>   
                                                                                       
                                           
                                                 <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Notify</label>
                                                                <div class="controls" style="width: 350px;">
                                                                   
                                                                    <select name="notifytest[]" id="chosenTest"  multiple="multiple" data-placeholder="Select..." >
                                                                      <? $i=0; foreach($user as $key){
																			?>	
																				<option  value="src=<?php echo $key->name ?>%40eyepax.com&amp;color=%23<?php echo $calendarColor[$i];?>&amp"><?php echo $key->displayName ?></option>
																			<? $i=$i+1; }?>
											                           </select>
                                                                </div>
                                                            </div>
                                                            
                                                              <button type="button" class="k-button" id="subCalendarTest" name='subCalendarTest' style="float: right; margin-top: -19px; background-image: url('images/calen.png'); background-repeat: no-repeat;background-size: 38px;padding: 17px 20px;"></button> 
                                                             
                                                    </div>  
                                            						
								<script>
                                    $(document).ready(function() {
                                      //  $("#chosen").kendoMultiSelect().data("kendoMultiSelect");  

                                        var windowWeek = $("#windowWeek"),
                                        undoWeek = $("#subCalendarTest").bind("click", function() {
                                                    windowWeek.data("kendoWindow").open();
                                                    var str=$('#chosenTest').val();
                                                	var rest =str.join("amp;");

                                                	var val = decodeURIComponent($('#chosenTest').val());                                                	
                                                	var myArray = val.split('src=');
                                                	var res=[];
                                                	for (var i = 1; i < myArray.length; i++) {
													   
													   var emai=myArray[i].split('&color=');
													   //alert(emai[0]);
													   res[i-1]=emai[0];
													}
                                                	//alert(res);
                                                	//var res =str.join("amp;");
                                                	var mail=$('#chosen').find('option:selected').text();
                                                	var user=mail.split('@eyepax.com');
                                               	var resUser =res.join(", ");
                                                	$("#heading").html('<div id="heading"><label>Calendar for '+resUser+'</label></div>');
                                                    $("#iframeCalendar").html('<div id="iframeCalendar"style="position: relative; top: 14px;"><iframe src="http://www.google.com/calendar/embed?showTitle=0&amp;showPrint=0&amp;mode=WEEK&amp;'+rest+'amp;ctz=Asia/Colombo" style="border: 0" width="1000" height="600" frameborder="0" scrolling="no"</div>></iframe>');
                                                	                                                                
                                                });
                                    var onClose = function() {
                                        undoWeek.show();
                                    }

                                    if (!windowWeek.data("kendoWindow")) {
                                        windowWeek.kendoWindow({
                                            width: "1020px",
                                             visible  : false,
                                            title: "Weekly Google Calendar",
                                            actions: [                                

                                                "Close"
                                            ],
                                            close: onClose
                                        });
                                        undoWeek.show();
                                    }
                
                                $("#windowWeek").closest(".k-window").css({
                                top: "10%",
                                left:"10%"
                                });                                 
                                    	
                                });

                                    
                            </script>
					</div>
                                            <div  class="span3" id="joindate"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Expected Joining Date</label>
                                                                <div class="controls">
                                                                   <input id="join" name="join" value="<?=$row['expectedJoinDate']?>" />
                                                                   
                                                                </div>
                                                            </div>
                                                    </div>  
<!--					<div class="popjoindate" id="joindate">
                                             <div  class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Expected Joining Date</label>
                                                                <div class="controls">
                                                                    <input id="testdate" value="<?=$row['expectedJoinDate']?>" />
                                                                </div>
                                                            </div>
                                                    </div>						
					</div>-->
                                    </fieldset>
                                        <fieldset>
                                      <legend> Last Comment Information </legend>
                                            <div id="commetBox" style="margin-left:12px;">
                                                <span style="color:red;font-size: 12px;"></span>
                                                <textarea cols="63" name="txtComment" id="txtComment"></textarea>

                                            </div>
                                                                    <?

                                                $config->host= $host;
                                                $config->port= "";     

                                                    $config->username= $jirauser;
                                                    $config->password= $jirapass;

                                                    $queryComment=new Jira($config);

                                // grab comments
                                                    $commentarray=$queryComment->queryComment($_GET['jiraid']);
                                                    $commentresponse1=json_decode($commentarray->responseBody);
                                                    $commentresponse=array_reverse($commentresponse1->comments);
                                                    $split=explode("T",$commentresponse[0]->updated);
                                                    $split2=explode(".",$split[1]);


                                        if(!empty($commentresponse1->comments)){?>
                                      
                                      <div class="appdetailbox" style="width: 523px;">
                                                    <div class="comment-body">
                                                        <blockquote style="  color: #FF5710;">
                                                        <h6><?=$commentresponse[0]->updateAuthor->displayName?></h6>
                                                        <small><?=$split[0]." ".$split2[0]?> </small>
                                                    </blockquote>
                                                    <blockquote>
                                                        <p><?=$commentresponse[0]->body?></p>
                                                      </blockquote>
                                                    </div>
                                                </div>                 
                                               
                                            <?}else{?>
                                            <div class="popcommentdetails">
                                                    <p>No comments recorded in JIRA</p>
                                            </div>
                                            <?}?>


                                    </fieldset>    
                                  </div>
                              <div>
                                        <fieldset>  
                                            <legend>Personal Details</legend>

                                                        <div class="span3"> 
                                                            <div class="control-group" style="margin-top: -23px;">
                                                                <label class="control-label" for="inputEmail">Name</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="name" id="fullname" value="<?php echo $row['applicantName'];?>" placeholder="Name">
                                                                </div>
                                                            </div>
                                                        </div>


                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">First Name</label>
                                                                <div class="controls2">
                                                                    <input type="text" name="firstname" id="firstname" class="k-textbox k-invalid" value="<?php echo $row['fname'];?>" placeholder="First Name">
                                                                </div>
                                                            </div>
                                                        </div>


                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Last Name</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="lastname" id="lastname" value="<?php echo $row['lname'];?>" placeholder="Last Name">
                                                                </div>
                                                            </div>
                                                        </div>
                                            <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">E-mail</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="email" value="<?php echo $row['email'];?>" placeholder="Telephone">
                                                                </div>
                                                            </div>
                                                         </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Telephone</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="tp" value="<?php echo $row['telephone'];?>" placeholder="Telephone">
                                                                </div>
                                                            </div>
                                                         </div>                               
                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Mobile</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="mobile"  value="<?php echo $row['mobileNo'];?>"  placeholder="Mobile">
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <?
                                                            if ($row['lname']==""){
                                                                    ?>
                                                                    <script type="text/javascript">
                                                                            var first_name = '';
                                                                            var last_name = '';
                                                                            var name=document.getElementById("fullname").value;
                                                                            if (name != null)
                                                                            {
                                                                                    var new_name = name.split(" ");

                                                                                    // Check the first part for a title/prefix
                                                                                    if (new_name[0].indexOf('.')!=-1)
                                                                                    {
                                                                                            new_name.shift();
                                                                                            first_name=new_name[0];
                                                                                            last_name=new_name.pop();
                                                                                            if(last_name=" "){
                                                                                            last_name=new_name.pop();
                                                                                            }
                                                                                    }
                                                                                     else
                                                                                    {
                                                                                      first_name = new_name.shift();
                                                                                      last_name = new_name.pop();
                                                                                      if(last_name=" "){
                                                                                            last_name=new_name.pop();
                                                                                            }
                                                                                    }

                                                                               document.getElementById("firstname").value=first_name;
                                                                               document.getElementById("lastname").value=last_name;
                                                                            }
                                                                    </script>

                                                                    <?
                                                            } ?>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Address 1</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="address1" value="<?=$row['address1']?>"  placeholder="Address 1">
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">Address 2</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="address2" value="<?=$row['address2']?>"  placeholder="Address 2">
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">NIC</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" id="nic" name="nic" onblur="nictosummary()" value="<?=$row['nic']?>" placeholder="NIC">
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="span3"> 
                                                            <div class="control-group">
                                                                <label class="control-label" for="inputEmail">City</label>
                                                                <div class="controls2">
                                                                    <input type="text" class="k-textbox k-invalid" name="city" value="<?=$row['city']?>"  placeholder="City">
                                                                </div>
                                                            </div>
                                                        </div>
                                                                    
                                                        <div id="ajaxattach">
                                                            <?
                                                            $config->username= $username;
                                                            $config->password= $pass;
                                                            $config->port= "";
                                                            $config->host= $host;
                                                            $query->id= $_GET['jiraid'];
                                                            $queryIssue = new Jira($config);
                                                            $array=$queryIssue->queryIssue($query);
                                                            $response = json_decode($array->responseBody);
                                                            if(isset($response->issues[0]->fields->description)){
                                                                    $sql="SELECT * from trn_attachments where id=".$DBID;
                                                                    $sq=mysql_query($sql);
                                                            ?>
                                                             <div class="span3"> 
                                                                <div class="control-group">
                                                                    <label class="control-label" for="inputEmail">Attachments </label>
                                                                    <div class="controls2">
                                                                       <?while($rowattach = mysql_fetch_array($sq)){
                                                                                    $url = $rowattach['name'];
                                                                                    $url = explode("http://eyepax.com/sites/default/files/cv/", $url);

                                                                                    if(isset($url[1])){
                                                                                            $name = $url[1];
                                                                                            $new_url = $rowattach['name'];
                                                                                    }else{
                                                                                            $name = $rowattach['name'];
                                                                                            $new_url = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/Attachments/".$rowattach['name'];
                                                                                    }
                                                                            ?>
                                                                        <?php
                                                                        $exten=substr(strrchr($name,'.'),1);
                                                                        
                                                                       // print_r($new_url);exit;
                                                                        switch ($exten){
                                                                                case('doc') :
                                                                                case('dot') :
                                                                                case('docx'):
                                                                                case('docm'):
                                                                                case('dotx'):
                                                                                case('docm'):
                                                                                { ?>
                                                                                    <div class="popattachments"style="float: none;"><a href="<?=$new_url;?>" target="_blank"><img src="images/word.png" style="width: 40px;"></a></div>
                                                                                    <div class="popdeleteattach" style="padding: 0 45px;"><a href="#" title="Delete Attachment" onclick="getattach('<?echo $rowattach['name']?>','<?echo $DBID?>','<?echo $_GET['jiraid']?>');"><img src="images/icon_delete.gif"></a></div>
                                                                            
                                                                        
                                                                               <?php }break;
                                                                                case('xlsb') :
                                                                                case('xlsx') :
                                                                                case('xlsm'):
                                                                                case('xltx'):
                                                                                case('xltm'):
                                                                                case('xlam'):
                                                                                case('xls'):
                                                                                { ?>
                                                                                    <div class="popattachments"style="float: none;"><a href="<?=$new_url;?>" target="_blank"><img src="images/excel.png" style="width: 40px;"></a></div>
                                                                                    <div class="popdeleteattach" style="padding: 0 45px;"><a href="#" title="Delete Attachment" onclick="getattach('<?echo $rowattach['name']?>','<?echo $DBID?>','<?echo $_GET['jiraid']?>');"><img src="images/icon_delete.gif"></a></div>
                                                                            
                                                                        
                                                                               <?php }break;
                                                                                case('pdf') :
                                                                               
                                                                                { ?>
                                                                                    <div class="popattachments"style="float: none;"><a href="<?=$new_url?>" target="_blank"><img src="images/pdf.png" style="width: 40px;"></a></div>
                                                                                    <div class="popdeleteattach" style="padding: 0 45px;"><a href="#" title="Delete Attachment" onclick="getattach('<?echo $rowattach['name']?>','<?echo $DBID?>','<?echo $_GET['jiraid']?>');"><img src="images/icon_delete.gif"></a></div>
                                                                            
                                                                        
                                                                               <?php }break;
                                                                                case "jpg":
                                                                                case "jpeg":
                                                                                case "png":
                                                                                case "bmp":
                                                                                case "dng":
                                                                                case "gif":
                                                                                case "psd":
                                                                                case "pspimage":
                                                                                case "tga":
                                                                                case "thm":
                                                                                case "tif":
                                                                                case "yuv":                                                                               
                                                                                { ?>
                                                                                    <div class="popattachments"style="float: none;"><a href="<?=$new_url?>" target="_blank"><img src="images/image.png" style="width: 40px;"></a></div>
                                                                                    <div class="popdeleteattach" style="padding: 0 45px;"><a href="#" title="Delete Attachment" onclick="getattach('<?echo $rowattach['name']?>','<?echo $DBID?>','<?echo $_GET['jiraid']?>');"><img src="images/icon_delete.gif"></a></div>
                                                                            
                                                                        
                                                                               <?php }break;
                                                                            case "jpg":
                                                                               default:                                                                               
                                                                                { ?>
                                                                                    <div class="popattachments"style="float: none;"><a href="<?=$new_url?>" target="_blank"><img src="images/default.png" style="width: 40px;"></a></div>
                                                                                    <div class="popdeleteattach" style="padding: 0 45px;"><a href="#" title="Delete Attachment" onclick="getattach('<?echo $rowattach['name']?>','<?echo $DBID?>','<?echo $_GET['jiraid']?>');"><img src="images/icon_delete.gif"></a></div>
                                                                            
                                                                        
                                                                               <?php }break;
                                                                                
                                                                        }
	
                                                                        ?>

                                                                                
                                                                    <?}?> 
                                                                    </div>
                                                                </div>
                                                            </div>
                                                                   
                                                            <?}?>
                                                            </div>
                                                       
                                                        <div class="span3" style="height: 35px;"> 
                                                            <div class="control-group" style=" padding: 25px 0;">
                                                                <?
                                                                    if($row['verified']=='0'){
                                                                    ?>
                                                                    <input type="checkbox" style="float:left;" value="0" name="referee"/>
                                                                    <?}
                                                                    else{
                                                                    ?>
                                                                    <input type="checkbox" checked="checked" style="float:left;" value="1" name="referee"/>
                                                                    <?}?>
                                                                    <p class="poprefreepara">referees verified</p>
                                                            </div>
                                                        </div>
                                                                    
                                                                  

                                        </fieldset>                            

                                  </div>
                                  <script>
//                                      function timecheck()
//                                      {
//                                          alert('Return');
//                                          return true;
//                                      }
                                  </script>
                            
                                  <div class="popupdate" style=" position: relative;">
                                      <button class="k-button" id="btnSave" type="submit"  name="update" onclick="return emailchange(); "
                                        style="float: right;
                                        font-family: inherit;
                                        font-size: 15px;
                                        line-height: 1.66em;
                                        margin: 12px 0;
                                        padding: 8px 7px;
                                        text-align: center;
                                        text-decoration: none;
                                        width: 100px;">Save</button>
                                                             
                            </div>
                        </form>
                              <form action='pdfgenerator.php?vcode=<?=$vcode?>' method='post'>
                              <div class="popupdate">
                                <button type="submit" value="PDF" name="pdf" class="k-button" id="btnClose"
                                        style="float: right;
                                        font-family: inherit;
                                        font-size: 15px;
                                        line-height: 1.66em;
                                        margin: 12px 0;
                                        padding: 8px 7px;
                                        text-align: center;
                                        text-decoration: none;
                                        width: 100px;">PDF</button>
                            </div>
                              </form> 
                                  </div>
                    </div>
                    <div class="span11">
                        <h2><?php if(isset($_GET['name'])){ echo "<b>".$_GET['name']."</b>";} ?></h2>
                        <?
                        $sql1="SELECT * from trn_emaildetails where id='".$DBID."'";
                        $rs1 =mysql_query($sql1);
                        $row = mysql_fetch_array($rs1);
                        ?>
                       <fieldset>  
                                <legend>Personal Details</legend>
                                <div class="appdetailbox">
                                    <div class="appdetail">First Name</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['fname']?></div>
                                </div>
                               <div class="appdetailbox">
                                    <div class="appdetail">Last Name</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['lname']?></div>
                                </div>                  
                                                          
                                 <div class="appdetailbox">
                                    <div class="appdetail">Address 1</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['address1']?></div>
                                </div>          
                                <div class="appdetailbox">
                                    <div class="appdetail">Address 2</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['address2']?></div>
                                </div>
                                <div class="appdetailbox">
                                    <div class="appdetail">Date of Birth</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['birthday']?></div>
                                </div> 
                                <div class="appdetailbox">
                                    <div class="appdetail">City</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['city']?></div>
                                </div>                                 
                                
                            </fieldset>                           
                         <fieldset>  
                                <legend>Qualification</legend>
                                <div class="appdetailbox">
                                    <div class="appdetail">School</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['school']?></div>
                                </div>
                                 <div class="appdetailbox">
                                    <div class="appdetail">Institute(University/School)</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['highschool']?></div>
                                </div>
                                <div class="appdetailbox">
                                    <div class="appdetail">Highest Professional Qualification</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['highprofessional']?></div>
                                </div>                  
                               
                            </fieldset> 
                        	<?
			$sql2="SELECT * from trn_projectexperience where mainid='".$row['id']."'";
			$rs2 =mysql_query($sql2);
			if(mysql_num_rows($rs2)>0){
			?>
                        <fieldset>  
                                <legend>Hands on Experience</legend>
                                <?
                                    $i=1;
                                    while($row1 = mysql_fetch_array($rs2)){

                                    ?>
                                 <div class="appdetailbox">
                                    <div class="appdetail">Project/Work Experience <?echo $i?></div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row1['experince']?></div>
                                </div> 
                        <?$i++;}}?>
                        </fieldset>
                          <fieldset>  
                                <legend>Technical Skills</legend>
                                <div class="appdetailbox">
                                    <div class="appdetail">Technologies Known</div>
                                    <div class="appseperator">:</div><div class="appinfo">
                                    <?
                                        $sql3="SELECT * from trn_technologyskills where mainid='".$row['id']."'";
                                        $rs3 =mysql_query($sql3);
                                        while($row2 = mysql_fetch_array($rs3)){
                                        $sql4="SELECT * from sys_technicalskills where id='".$row2['techid']."'";
                                        $rs4 =mysql_query($sql4);
                                        $row3 = mysql_fetch_array($rs4);
                                        ?>
                                        <?=$row3['skillname']?> <b><?=$row2['ratevalue']?>/10</b> &nbsp;&nbsp;
                                    <?}?>
                                </div></div>
                               
                            </fieldset> 
                        <?
			$sqlquery="SELECT * from trn_workexperience where mainid='".$row['id']."'";
			$result=mysql_query($sqlquery);
			if(mysql_num_rows($result)>0){			
			?>
                            <fieldset>  
                                <legend>Working Experience</legend>
                            
                            <?
                            $sql5="SELECT * from trn_workexperience where mainid='".$row['id']."' AND currentplace = '1'";
                            $rs5 =mysql_query($sql5);
                            while($row4 = mysql_fetch_array($rs5)){
                            ?>	
                                			
							<div class="appworkwrapper">
							<div class="appworkdetailbox"> 
								<div class="appdetail">Current Workplace</div>
							</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Designation</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row4['designation']?></div>
								</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Company</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row4['companyname']?></div>
								</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Join Date</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row4['joineddate']?></div>
								</div>
							</div>
			<?
			}
			$sql6="SELECT * from trn_workexperience where mainid='".$row['id']."' AND currentplace = '0'";
			$rs6 =mysql_query($sql6);
			while($row5 = mysql_fetch_array($rs6)){
			?>
							<div class="appworkwrapper">
							<div class="appworkdetailbox"> 
								<div class="appdetail">Previous Workplace</div>
							</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Designation</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row5['designation']?></div>
								</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Company</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row5['companyname']?></div>
								</div>
								<div class="appworkdetails"> 
									<div class="appworkdesig">Join Date</div><div class="appseperator">:</div>
									<div class="appworkinfo"><?=$row5['joineddate']?></div>
								</div>
							</div>
                        <?}}?>				
                        </fieldset>
                         <fieldset>  
                                <legend>Joining EYEPAX</legend>
                                <div class="appdetailbox">
                                    <div class="appdetail">Current Salary</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['currentSalary']?></div>
                                </div>
                                <div class="appdetailbox">
                                    <div class="appdetail">Expected Salary</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['expectedsalary']?></div>
                                </div>
                                <div class="appdetailbox">
                                    <div class="appdetail">How soon can you join</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['howsoon']?></div>
                                </div>
                                 <div class="appdetailbox">
                                    <div class="appdetail">Why we should hire you</div>
                                    <div class="appseperator">:</div>
                                    <div class="appinfo"><?=$row['whyhire']?></div>
                                </div>
                            </fieldset> 
                    </div>
                   
                    <div class="span11" style="min-height: 452px;">
                        <div class="weather">
                            <fieldset>
                                <div class="popcontainer2" style="min-width: 548px; margin-top: 10px;">
				<?
				$activitysql="SELECT *, concat( FROM_UNIXTIME(modifiedDate ) ) as dat from trn_activity where mainId='".$DBID."' ORDER BY modifiedDate DESC";
				$r =mysql_query($activitysql);
				while($row2 = mysql_fetch_array($r)){
                                    $displayName=  getName($username, $pass, $host,$row2['modifiedBy']);
                                    //echo $displayName->displayName;
				?>
                                   <div class="appdetailbox" style="width: 508px;">
                                            <div class="comment-body">
                                                <blockquote style="  color: #FF5710;">
                                                <h6><?=$displayName->displayName?></h6>
                                                <small><?=$row2['dat']?> </small>
                                        </blockquote>
                                        <blockquote>
                                            <p><?=$row2['description']?></p>
                                          </blockquote>
                                        </div>
                                    </div> 
					
				<?}?>
			</div>
			<div class="interviewhistorycontainer" style="margin-top: 10px;">
				<p class="popinterviewpara">Interview History</p>
			<?
			$activitysqlinterview="SELECT * from trn_activity where mainId='".$DBID."' ORDER BY modifiedDate DESC";
			$inter =mysql_query($activitysqlinterview);
			while($rownew1 = mysql_fetch_array($inter)){
			if(!empty($rownew1['SDateTime'])){		
			?>
			
				<div class="popinterviewhistory">
					<?=$rownew1['status'];?> On <?=date('Y-m-d',$rownew1['SDateTime'])?> at <?=date('g:i a',$rownew1['SDateTime'])?> to <?=date('g:i a',$rownew1['EDateTime'])?>
				</div>
			
			<?}}?>
			</div>
                           
                           </fieldset>
                        </div>
                                              
                    </div>
                     <div class="span11" style="min-height: 452px;">
                        <div class="weather"> 
                            <fieldset>
                            <?
                            if(!empty($commentresponse1->comments)){
                            foreach($commentresponse1->comments as $key){
                            $split3=explode("T",$key->updated);
                            $split4=explode(".",$split3[1]);				
                            ?>
                                <div class="appdetailbox">
                                    <div class="comment-body">
                                    <blockquote>
                                        <h6><?=$key->updateAuthor->displayName?></h6>
                                        <small><?=$split3[0]." ".$split4[0]?> </small>
                                    </blockquote>
                                    <blockquote>
                                        <p><?=$key->body?></p>
                                      </blockquote>
                                    </div>
                                </div>                           
                            <?}}else{?>
                            <div class="popcommentdetailstab">
                                <p>No comments recorded in JIRA</p>
                            </div>
                            <?}?>
                           
                        </fieldset>
                        </div>
                        
                    </div>
                    
                     <div class="span11" style="min-height: 452px;">
                        <div class="weather"> 
                            <fieldset>
                            <?
                            $sqlhistory="SELECT a.*,b.postname from trn_emaildetails a INNER JOIN sys_jobposts b ON a.post=b.code where a.deleted='0' AND a.email='".$row['email']."' AND a.jiraTaskID !='".$_GET['jiraid']."'";
                            $rshistory =mysql_query($sqlhistory);
                            if(mysql_fetch_array($rshistory) !== false){
	                            while($rowhistory = mysql_fetch_array($rshistory)){
									$i=0;
									$hisprojectname=getquery($username,$pass,$host,$rowhistory['jiraTaskID'])->issues[0]->key;
									//var_dump($hisprojectname); 
									$secrec="SELECT * FROM trn_activity WHERE mainId ='".$rowhistory['id']."'ORDER BY id LIMIT 1 OFFSET 1";
									$rssechistory =mysql_query($secrec);
									$rowsechistory = mysql_fetch_array($rssechistory);
									
									$commentarray1=$queryComment->queryComment($rowhistory['jiraTaskID']);
									$commentresponse11=json_decode($commentarray1->responseBody);
									$commentresponse1=array_reverse($commentresponse11->comments);
									$split1=explode("T",$commentresponse1[0]->updated);
									$split21=explode(".",$split1[1]);
									$i=$i+1;
									
									
									//echo  $rowhistory['jiraTaskID'].'<br>';
									
									
									if($hisprojectname!=''){
									                                                
							?>
											<div class="appdetailbox" style="border: 1px groove #A0A2A0;">
			                                    <div class="comment-body">
			                                    <blockquote style="  color: #3C9632;">
			                                    
			                                        <h6 style="font-size: 15px;"><a href="https://eyepax.atlassian.net/browse/<?=$hisprojectname?>" target="_blank">JIRA ID : <?=$hisprojectname?> </a></h6>
			                                        <small><?php echo DATE("Y-M-d", STRTOTIME($rowhistory['recordedDate'])) ;?> </small>
			                                    </blockquote>	
			                                     <blockquote>
			                                     <div class="appworkdetails" style="float: none; width: auto;">
			                                        <div class="appdetail">Post</div><div class="appseperator">:</div><div class="appinfo"> <?php echo $rowhistory['postname'];?></div>
			                                        </div>
			                                        <div class="appworkdetails" style="float: none; width: auto;">
			                                        <div class="appdetail">Previous state</div><div class="appseperator">:</div><div class="appinfo"> <?php echo $rowsechistory['status'];?></div>
			                                     </div>
			                                      </blockquote>	
			                                      <div class="appworkdetails" style="float: none; width: auto;">
			                                       <div class="appdetail">History</div>
                                                   <div class="appseperator">:</div>
                                                   <div class="appinfo">
                                                        	<blockquote style="color: #FF5710;">                                                       
                                                        		<h6><?=$commentresponse1[0]->updateAuthor->displayName?></h6>
                                                        		<small><?=$split1[0]." ".$split21[0]?> </small>
                                                    		</blockquote>
                                                    		<blockquote>
                                                        		<p><?=$commentresponse1[0]->body?></p>
                                                      		</blockquote>
                                                      		</div>
                                                     	</div>                                   
			                                    </div>
			                                </div>   
	
								<?php }}
							}
							else { ?>
								<div class="popcommentdetailstab">
									<p>No records found</p>
									</div>
						<?php	} ?>
							
							
                           
                           
                        </fieldset>
                        </div>
                        
                    </div>
                </div>
            </div>

            
            
            
            <style scoped>
                
                span.k-datepicker, span.k-timepicker, span.k-datetimepicker, span.k-colorpicker, span.k-numerictextbox, span.k-combobox, span.k-dropdown {
                    
                    
                    width: 200px;
                }
                .control-group{
                    height: 32px;
                    
                }
                input[type="text"] {
                    width: 200px;
                }
                .comment-body {
                    background: none repeat scroll 1px 17px #FFFFFF;
                    border: 1px solid #D4D4D4;
                    /*box-shadow: 1px 0 43px #DADADA inset, 0 0 1px #A5DFDF inset;*/
                    margin: 0 0 0;
                    padding: 4px;
                }
                .appdetailbox{
                            background: none repeat scroll 0 0 #F3F3F3;
                       border: 1px dotted #BBBBBB;
                       border-radius: 5px 5px 5px 5px;
                       float: left;
                       height: auto;
                       margin: 12px 12px 0;
                       /*padding: 14px 12px 0px;*/
                       width: 98%;
                       min-height: 30px;
                   }
                   .appseperator {
                        float: left;
                        font-weight: bold;
                    }
                    
                .appinfo {
                  /*  float: left;
                    height: auto;
                    margin-left: 12px;
                    width: auto;*/
                    
                    float:none;
					margin-left: 238px;
				    position: relative;
				    width:auto;
                }
                .appdetail {
                    float:left;
                    font-size:14px;
                    font-weight:bold;
                    width:218px;
                  }

                .controls{
                   margin-left: 25%;
/*                    margin-top: -4%;
                    padding: 1%;*/
                }
                 .controls2{
                   margin-left: 30%;
/*                    margin-top: -4%;
                    padding: 1%;*/
                }
                .input-xlarge{
                    width: 65%;
                }

                .comentDiv{
                    border: 1px solid #C6C6C6;
                    border-radius: 5px 5px 5px 5px;
                    height: 50px;
                    margin: 10px;
                     
                     box-shadow: 0 0 1px #606060;
                }
                th{
                    font-size: 14px;
                    font-style: italic;
                     text-align: left;
                }
            #forecast {
                    /*width: 360px;*/
                    /*height: 337px;*/
                    /*margin: 30px auto;*/
                    /*padding: 80px 15px 0 15px;*/
                    /*background: url('../../content/web/tabstrip/forecast.png') transparent no-repeat 0 0;*/
                }

                .sunny, .cloudy, .rainy {
                    display: inline-block;
                    margin: 20px 0 20px 10px;
                    width: 128px;
                    height: 128px;
                    /*background: url('../../content/web/tabstrip/weather.png') transparent no-repeat 0 0;*/
                }

                .cloudy{
                    background-position: -128px 0;
                }

                .rainy{
                    background-position: -256px 0;
                }

                .weather {
                    /*width: 160px;*/
                    padding: 15px 0 0 0;
                    /*float: right;*/
                    height: auto;
                }

                #forecast h2 {
                     font-size: 3em;
                        font-weight: lighter;
                        margin: 11px;
                        padding: 0;
                }

                #forecast h2 span {
                    background: none;
                    padding-left: 5px;
                    font-size: .5em;
                    vertical-align: top;
                }

                #forecast p {
                    margin: 0;
                    padding: 0;
                }
 
                .forms li {
                    list-style: none outside none;
                    margin-bottom: 5px;
                }
                input[type="text"]{
                    /*width: 350px;*/
                }
                tr{
                    /*border-bottom: 1px solid #C6C6C6;*/
                }
                td{
                    padding:12px 3px 0px;
                }
                h5{
                    color: #3C3C3C;
                }
                tabstrip
                {
                    overflow: auto;
                }
                .left{
                    float: left;
                    width: 57%;
                }
                .right{
                    float: right;
                     width: 40%;
                }
                .jira_text{
                    width: 200px;
                }
                
                .box{
                    display:block;
                    padding: 0px 2px;
                    border: 1px solid #ddd;
                    background: #eee;
                    width: 100%;
                    height: 260px;
                    margin: 0px -4px 4px;
                }
                
                .popupdate{
                    /*float: right;*/
                    height: auto;
                    margin-left: 21px;
                    margin-top: 0;
                    /*width: 80px;*/
                }
                .poppdf{
                        float: left;
                    height: 35px;
                    margin-left: 21px;
                    margin-top: 38px;
                    width: 80px;
                }
                .poppdf img {
                    width: 50px;
                }
                .popupdate img {
                    width: 50px;
                }
                .k-tabstrip .k-tabstrip-items {
                    padding: 0.3px 0.3px 0;
                    position: relative;
                    top: 2px;
                }
                .textboxWidth{
                    width: 207px;
                }
                .textboxWidthPersonal{
                    width: 300px;
                }
                
                .popcontainer2 {
                padding: 0 7px 12px;
                }
            </style>

            <script>
                $(document).ready(function() {
                    $("#tabstrip").kendoTabStrip({
                        animation:  {
                            open: {
                                duration: 500,
                                effects: "fadeIn"
                            }
                        }
                    });
                });
                
                $(document).ready(function () {
                $('.box').hide();
                $('#status1').show();
                $('#reqstatus').change(function () {
                    $('.box').hide();
                    $('#'+$(this).val()).show();
                });
                
                $('#btnClose').click(function () {
                    window.close();
                });
                 $('#btnInfoClose').click(function () {
                    window.close();
                });
            });
            </script>
        </div>


    
</body>
</html>

